<template>
  <div class="ant_poly_skeleton" :style="{background}">
    <div class="antd-row" v-if="loading" :style="{padding,margin,gridTemplateColumns:`repeat(${num / rows},1fr)`,gridTemplateRows:`repeat(${rows},1fr)`,gap: `${gap}px`}">
      <div class="ant-skeleton" v-for="item in num" :key="item" :style="{width,height}">
      </div>
    </div>
    <div v-show="!loading">
      <slot />
    </div>
  </div>
</template>

<script>
export default {
  name:"AGridSkeleton",
  props: {
    width: { type: String, default: "100%" },
    height: { type: String, default: "40px" },
    padding: { type: String, default: "0" },
    margin: { type: String, default: "0" },
    background: { type: String, default: null },
    parentPadding: { type: String, default: "0" },
    parentMargin: { type: String, default: "0" },
    loading: { type: Boolean, default: true },
    num: { type: Number, default: 3 },
    rows: { type: Number, default: 3 },
    gap: { type: Number, default: 0 },
  }
}
</script>

<style lang="scss" scoped>
@import url("./index.scss");
</style>